package com.android.tetris;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.android.tetris.R.id;
import com.android.tetris.utils.Activities;
import com.android.tetris.utils.Utils;

public class Intro extends Activity implements OnClickListener {
	private Intent intent;
	private Button btnNewGame;
	private Button btnHighScores;
	private Button btnAuthors;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        // Init View
        initView();
    }

    private void initView(){
    	// Set tham chieu den cac buttons
    	btnNewGame = (Button)findViewById(R.id.btnNewGame);
    	btnHighScores = (Button)findViewById(R.id.btnHighScores);
    	btnAuthors = (Button)findViewById(id.btnAuthors);
    	
    	// Set Action cho cac button
    	btnNewGame.setOnClickListener(this);
    	btnHighScores.setOnClickListener(this);
    	btnAuthors.setOnClickListener(this);
    }
    
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch(v.getId()){
		case R.id.btnNewGame:
			intent = Utils.browseIntent(this, Activities.GAME.toString());
			startActivity(intent);
			break;
		case R.id.btnHighScores:
			intent = Utils.browseIntent(this, Activities.HIGHSCORES.toString());
			startActivity(intent);
			break;
		case R.id.btnAuthors:
			intent = Utils.browseIntent(this, Activities.AUTHORS.toString());
			startActivity(intent);
			break;
		}
	}

}